BODYNN n/a   IE 4   DOM 1

The BODY object reflects the BODY element, which is distinct from the document object. The BODY object refers to just the element and its nested content. The BODY object is special in IE 4 in that it is the gateway to many important visual aspects of content on the page, such as background, margins, and scrolling. There is a shortcut reference to the object, document.body, so you don't have to build a reference via the document.all.elementID hierarchy.

 
HTML Equivalent
<BODY>
 
Object Model Reference
IE [window.]document.body
accessKeyNN n/a   IE 4   DOM n/a
 Read/Write
 

A single character key that brings focus to an element. The browser and operating system determine whether the user must press a modifier key (e.g., Ctrl, Alt, or Command) with the access key to bring focus to the element. In IE 4/Windows, the Alt key is required, and the key is not case sensitive. Not working in IE 4/Mac.

 
Example
document.body.accessKey = "n"
 
Value
Single alphanumeric (and punctuation) keyboard character.
 
Default None.
backgroundNN n/a   IE 4   DOM 1
 Read/Write
 

URL of the background image for the entire document. If you set a bgColor to the element as well, the color appears if the image fails to load; otherwise, the image overlays the color.

 
Example
document.body.background = "images/watermark.jpg"
 
Value
Complete or relative URL to the background image file.
 
Default None.
bgColorNN n/a   IE 4   DOM 1
 Read/Write
 

Background color of the element. Even if the BGCOLOR attribute or bgColor property is set with a plain-language color name, the returned value is always a hexadecimal triplet.

 
Example
document.body.bgColor = "yellow"
 
Value
A hexadecimal triplet or plain-language color name.
 
Default Varies with browser and operating system.
bgPropertiesNN n/a   IE 4   DOM n/a
 Read/Write
 

Whether the background image remains in a fixed position or scrolls as a user scrolls the page. When the background image is set to remain in a fixed position, scrolled content flows past the background image very much like film credits roll past a background image on the screen.

 
Example
document.body.bgProperties = "fixed"
 
Value
Case-insensitive constant string values: fixed | scroll.
 
Default scroll
bottomMarginNN n/a   IE 4   DOM n/a
 Read/Write
 

The amount of blank space between the very end of content and the bottom of a scrollable page. The setting has no visual effect if the length of the content or size of the window does not cause the window to scroll. The default value is for the end of content to be flush with the end of the document, but in the Macintosh version of Internet Explorer 4, there is about a 10-pixel margin visible even when the property is set to zero. Larger sizes are reflected properly. This property offers somewhat of a shortcut or alternate to setting the marginBottom style sheet property for the BODY element object.

 
Example
document.body.bottomMargin = 20
 
Value
An integer value (zero or greater) of the number of pixels of clear space at the bottom of the document.
 
Default 0
clientHeight, clientWidthNN n/a   IE 4   DOM n/a
 Read/Write
 

According to Microsoft's developer documentation, these properties reflect the height and width (in pixels) of the element's content.

 
Example
var midHeight = document.body.clientHeight/2
 
Value
Integer pixel value.
 
Default None.
clientLeft, clientTopNN n/a   IE 4   DOM n/a
 Read-only
 

According to Microsoft's developer documentation, these properties reflect the distance between the "true" left and top edges of the document area and the edges of the element. To get or set the pixel position of an element in the document, use the pixelLeft and pixelTop properties.

 
Value
A string value for a length in a variety of units or percentage.
 
Default None.
leftMarginNN n/a   IE 4   DOM n/a
 Read/Write
 

Width in pixels of the left margin of the BODY element in the browser window or frame. By default, the browser inserts a small margin to keep content from abutting the left edge of the window. Setting the property to an empty string is the same as setting it to zero.

 
Example
document.body.leftMargin = 16
 
Value
Integer of pixel count.
 
Default 10 (Windows); 8 (Macintosh).
noWrapNN n/a   IE 4   DOM 1
 Read/Write
 

Whether the browser should render the body content as wide as is necessary to display a line of nonbreaking text on one line. Abuse of this attribute can force the user into a great deal of inconvenient horizontal scrolling of the page to view all of the content.

 
Example
document.body.noWrap = "true"
 
Value
Boolean value: true | false.
 
Default false
recordNumberNN n/a   IE 4   DOM n/a
 Read-only
 

Used with data binding, returns an integer representing the record within the data set that generated the element). Values of this property can be used to extract a specific record from an Active Data Objects (ADO) record set (see recordset property).

 
Example
<SCRIPT FOR="tableTemplate" EVENT="onclick">
    myDataCollection.recordset.absoluteposition = this.recordNumber
    ...
</SCRIPT>
 
Value
Integer.
 
Default None.
rightMarginNN n/a   IE 4   DOM n/a
 Read/Write
 

Width in pixels of the right margin of the BODY element in the browser window or frame. By default, the browser inserts a small margin to keep content from abutting the right edge of the window (except on the Macintosh). Setting the property to an empty string is the same as setting it to zero.

 
Example
document.body.leftMargin = 16
 
Value
Integer of pixel count.
 
Default 10 (Windows); 0 (Macintosh).
scrollNN n/a   IE 4   DOM n/a
 Read/Write
 

Whether the window (or frame) displays scrollbars when the content exceeds the window size.

 
Example
document.body.scroll = "no"
 
Value
Not exactly a Boolean value. Requires one of the following string values: yes | no.
 
Default yes
scrollHeight, scrollWidthNN n/a   IE 4   DOM n/a
 Read-only
 

The meaning of these two properties is ambiguous based on Microsoft's description and the way they're implemented in the Windows and Macintosh versions of Internet Explorer 4. My best guess is that these properties are intended to measure the height and width (in pixels) of the content of an element, even when some of the content cannot be seen unless scrolled with scrollbars. The Macintosh version of the browser interprets this to mean the amount of the content that you can see at any one time. The important point is that for key elements, such as the BODY, the properties mean different things and can disrupt cross-platform operation.

 
Example
var midPoint = document.body.scrollHeight/2
 
Value
Positive integer or zero.
 
Default None.
scrollLeft, scrollTopNN n/a   IE 4   DOM n/a
 Read/Write
 

The distance in pixels between the actual left or top edge of the element's physical content and the left or top edge of the visible portion of the content. Setting these properties allows you to use a script to adjust the scrolling of content within a scrollable container, such as text in a TEXTAREA element or an entire document in the browser window or frame. When the content is not scrolled, both values are zero. Setting the scrollTop property to 15 scrolls the document upward by 15 pixels in the window; the scrollLeft property is unaffected unless explicitly changed. The property values change as the user adjusts the scrollbars.

 
Example
document.body.scrollTop = 40
 
Value
Positive integer or zero.
 
Default 0
tabIndexNN n/a   IE 4   DOM 1
 Read/Write
 

A number that indicates the sequence of this element within the tabbing order of all focusable elements in the document. Tabbing order follows a strict set of rules. Elements that have values other than zero assigned to their tabIndex properties are first in line when a user starts tabbing in a page. Focus starts with the element with the lowest tabIndex value and proceeds in order to the highest value, regardless of physical location on the page or in the document. If two elements have the same tabIndex values, the element that comes earlier in the document receives focus first. Next come all elements that either don't support the tabIndex property or have the value set to zero. These elements receive focus in the order in which they appear in the document. A value of -1 removes the element from tabbing order altogether.

Note that the Macintosh user interface does not provide for giving focus to elements other than text and password INPUT fields.

 
Example
document.body.tabIndex = 0
 
Value
Integer.
 
Default None.
textNN n/a   IE 4   DOM 1
 Read/Write
 

The color of text for the entire document body. Equivalent to the foreground color.

 
Example
document.body.text = "darkred"
 
Value
A hexadecimal triplet or plain-language color name.
 
Default Browser default (user customizable).
topMarginNN n/a   IE 4   DOM n/a
 Read/Write
 

Width in pixels of the top margin of the BODY element in the browser window or frame. By default, the browser inserts a small margin to keep content from abutting the top edge of the window. Setting the property to an empty string is the same as setting it to zero.

 
Example
document.body.topMargin = 16
 
Value
Integer of pixel count.
 
Default 15 (Windows); 8 (Macintosh).
createTextRange( )NN n/a   IE 4   DOM n/a

Creates a TextRange object from the source code of the current element. See the TextRange object for details.

 
Returned Value
TextRange object.
 
Parameters
None.